#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable:6031)

#include "Stack.h"

int main()
{
	Stack s;
	StackInit(&s);

	char tmp = '\0';

	while ((tmp = getchar()) != '@')
	{
		if (tmp == '(')
		{
			StackPush(&s, tmp);
		}
		if (tmp == ')')
		{
			if (!StackEmpty(&s))
			{
				StackPop(&s);
			}
			else
			{
				printf("NO");
				scanf("%*s");
				StackDestory(&s);
				return 0;
			}
		}
	}

	if (!StackEmpty(&s))
	{
		printf("NO");
	}
	else
	{
		printf("YES");
	}

	StackDestory(&s);

	return 0;
}